package com.smartstate.dataManagement.controller;

import com.smartstate.dataManagement.dto.PageDTO;
import com.smartstate.dataManagement.service.RateCalculationService;
import com.smartstate.dataManagement.service.RateService;
import com.smartstate.dataManagement.vo.RateCalculationVo;
import com.smartstate.dataManagement.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>费率</p>
 * <p>@Author 陈永杰</p>
 * <p>@Date: 2022/8/25</p>
 * <p>@Time: 16:46</p>
 * <p>@version 1.0 <p>
 */
@RestController
@Api(tags = {"费率"})
@RequestMapping("/RateCalculation")
public class RateCalculationController {

    @Autowired
    private RateCalculationService rateCalculationService;

    @Autowired
    private RateService rateService;

    /**
     * 增加费率信息  判断峰值 平值 谷值
     *
     * @param
     * @return
     */
    @PostMapping("/addRateCalculation")
    @ApiOperation(value = "增加费率信息")
    public ResultVO addRate(@RequestBody RateCalculationVo rateCalculationVo) {
       return ResultVO.ok(rateCalculationService.addRatecalculation(rateCalculationVo));
    }

    /**
     * 修改费率信息  判断峰值 平值 谷值
     *
     * @param
     * @return
     */
    @PostMapping("/updateRate")
    @ApiOperation(value = "修改费率信息")
    public ResultVO updateRate(@RequestBody RateCalculationVo rateCalculationVo) {
        return ResultVO.ok(rateCalculationService.updateRate(rateCalculationVo));
    }




    /**
     * 获取费率所有信息分页
     *
     * @param
     * @return
     */
    @PostMapping("/selectRatePage")
    @ApiOperation(value = "获取费率所有信息分页")
    public ResultVO selectRatePage(@RequestBody PageDTO<RateCalculationVo> pageDT) {
        return ResultVO.ok(rateService.queryAllPageByDTO(pageDT));
    }



}